package utils;


import java.io.*;
import java.util.Properties;

/**
 * @ClassName LoadPFromP
 * @Description TODO
 * @Author Lyon
 * @Date 2018/8/20 14:36
 **/
public class LoadPFromP {

    public String getProperty(String key) {

        System.out.println(System.getProperty("user.dir"));
        Properties p = new Properties();
        InputStream is = null;
        String value = null;
        try {
            is = new BufferedInputStream(new FileInputStream(System.getProperty("user.dir")+"/src/"+"Configuration.properties"));
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
        try {
            p.load(is);
            is.close();
        } catch (IOException e) {
        	System.out.println("");
            e.printStackTrace();
        }
        return p.getProperty(key);
    }

    public String getdbProperty(String key) {
        Properties p = new Properties();
        InputStream is = null;
        String value = null;
        try {
            is = new BufferedInputStream(new FileInputStream(System.getProperty("user.dir")+"/src/"+"db.properties"));
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
        try {
            p.load(is);
            is.close();
        } catch (IOException e) {
        	System.out.println("");
            e.printStackTrace();
        }
        return p.getProperty(key);
    }
}
